//
//  TabBarItem.m
//  Test
//
//  Created by 祝文博 on 15/3/3.
//  Copyright (c) 2015年 KevinLab. All rights reserved.
//

#import "TabBarItem.h"

#define kTitleRation 0.3
@implementation TabBarItem

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    
    if (self) {
        self.titleLabel.textAlignment = NSTextAlignmentCenter;
        self.titleLabel.font = [UIFont systemFontOfSize:10];
        self.imageView.contentMode = UIViewContentModeCenter;
        
        [self setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        [self setTitleColor:[UIColor whiteColor] forState:UIControlStateSelected];
    }
    return self;
}

- (void)setHighlighted:(BOOL)highlighted
{
    
}

- (CGRect)imageRectForContentRect:(CGRect)contentRect
{
    return CGRectMake(0, 0, contentRect.size.width, contentRect.size.height * (1 - kTitleRation));
}

- (CGRect)titleRectForContentRect:(CGRect)contentRect
{
    return CGRectMake(0, contentRect.size.height * (1 - kTitleRation) - 3, contentRect.size.width, contentRect.size.height * kTitleRation);
}

@end
